* Fixed the makefile to only run enabled tests, instead of every file in the director...
authorTim Starling <tstarling@users.mediawiki.org>
Fri, 25 Jun 2010 09:01:41 +0000 (09:01 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Fri, 25 Jun 2010 09:01:41 +0000 (09:01 +0000)
* Removed the perl dependency from the default "make test". There doesn't seem to be a memory issue anymore, but you can always use one of the non-default targets if it recurs.
* Fixed a couple of test/suite names broken in r68544.
* Added custom CSS to Special:Selenium, accidentally missing from r68555.

includes/specials/SpecialSelenium.php
maintenance/tests/Makefile
maintenance/tests/MediaWikiParserTest.php
maintenance/tests/ParserHelpers.php
maintenance/tests/TestFileList.php [new file with mode: 0644]
maintenance/tests/phpunit
maintenance/tests/phpunit.xml

index 442c280..93d57ca 100644 (file)
@@ -48,6 +48,7 @@ class SpecialSelenium extends SpecialPage {
                $result = new PHPUnit_Framework_TestResult;
                $logger = new SeleniumTestHTMLLogger;
                $result->addListener( new SeleniumTestListener( $logger ) );
+               $logger->setHeaders();
 
                // run tests
                $suite = new SeleniumTestSuite;
index e35ecc6..ece423c 100644 (file)
@@ -1,23 +1,32 @@
-# See
-# http://lists.wikimedia.org/pipermail/wikitech-l/2010-February/046657.html
-# for why prove(1) is the default target and not phpunit(1)
+# If you have problems with excessive memory usage, use the "tap" or "separate" targets.
 
-.PHONY: help test
-all test: tap
+TEST_FILES=$(shell php -r 'include( "./TestFileList.php" ); echo implode( " ", $$testFiles );')
+TEST_FILE_TARGETS=$(subst .php,.target,$(TEST_FILES))
 
-tap:
-       prove -e 'php phpunit.php --tap' *Test*.php
+.PHONY: help test phpunit tap separate install $(TEST_FILE_TARGETS)
+
+all test: phpunit
 
 phpunit:
-       phpunit
+       php phpunit
+
+tap:
+       prove -e 'php phpunit --tap' *Test*.php
+
+separate: $(TEST_FILE_TARGETS)
+
+# Need --tap because without it, the target specification doesn't work
+$(TEST_FILE_TARGETS) : %.target : %.php
+       php phpunit --tap $<
 
 install:
        pear channel-discover pear.phpunit.de
        pear install phpunit/PHPUnit
 
 help:
-       # Options:
-       #       test (default)          Run the tests individually through Test::Harness's prove(1)
-       #       phpunit                 Run all the tests with phpunit
-       #       install                 Install PHPUnit from phpunit.de
-       #       help                    You're looking at it!
+       # Targets:
+       #   phpunit (default)   Run all the tests with phpunit
+       #   separate            Run each test file in a separate process
+       #   tap                 Run the tests individually through Test::Harness's prove(1)
+       #   install             Install PHPUnit from phpunit.de
+       #   help                You're looking at it!
index ebeffd6..0410a96 100644 (file)
@@ -11,6 +11,7 @@ class MediaWikiParserTestSuite extends PHPUnit_Framework_TestSuite {
        public function __construct() {
                $this->backend = new ParserTestSuiteBackend;
                parent::__construct();
+               $this->setName( 'Parser tests' );
        }
 
        public function run( PHPUnit_Framework_TestResult $result = null, $filter = false, 
index 3288df8..ec73402 100644 (file)
@@ -49,6 +49,10 @@ class ParserUnitTest extends PHPUnit_Framework_TestCase {
                return $result;
        }
 
+       public function toString() {
+               return $this->test['test'];
+       }
+
 }
 
 class ParserTestSuiteBackend extends ParserTest {
diff --git a/maintenance/tests/TestFileList.php b/maintenance/tests/TestFileList.php
new file mode 100644 (file)
index 0000000..f3d86ff
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+
+$testFiles = array(
+       #'ApiTest.php',
+       #'ApiWatchTest.php',
+       'CdbTest.php',
+       'DatabaseSqliteTest.php',
+       'DatabaseTest.php',
+       'GlobalTest.php',
+       #'HttpTest.php',
+       'IPTest.php',
+       'ImageFunctionsTest.php',
+       'LanguageConverterTest.php',
+       'LicensesTest.php',
+       'LocalFileTest.php',
+       'MediaWikiParserTest.php',
+       'MessageTest.php',
+       'RevisionTest.php',
+       'SanitizerTest.php',
+       'SearchDbTest.php',
+       'SearchEngineTest.php',
+       'SearchUpdateTest.php',
+       'SiteConfigurationTest.php',
+       'TimeAdjustTest.php',
+       'TitlePermissionTest.php',
+       'TitleTest.php',
+       'UploadTest.php',
+       'UploadFromUrlTestSuite.php',
+       'XmlTest.php',
+);
index 55659e2..1e477fe 100755 (executable)
@@ -24,6 +24,18 @@ of PHPUnit do not properly implement dependencies.
 EOF;
 }
 
-$command = new PHPUnit_TextUI_Command;
+class MWPHPUnitCommand extends PHPUnit_TextUI_Command {
+       protected function handleCustomTestSuite() {
+               require( dirname( __FILE__ ) . '/TestFileList.php' );
+               $suite = new PHPUnit_Framework_TestSuite;
+               foreach ( $testFiles as $file ) {
+                       $suite->addTestFile( $file );
+               }
+               $suite->setName( 'MediaWiki test suite' );
+               $this->arguments['test'] = $suite;
+       }
+}
+
+$command = new MWPHPUnitCommand;
 $command->run( $argv );
 
index 1cf7277..d7eeda4 100644 (file)
@@ -5,36 +5,8 @@
          convertErrorsToExceptions="true"
          convertNoticesToExceptions="true"
          convertWarningsToExceptions="true"
-         stopOnFailure="false">
-  <testsuite name="MediaWiki Test Suite">
-    <!-- <directory>.</directory> -->
-    <!-- <file>ApiTest.php</file> -->
-    <!-- <file>ApiWatchTest.php</file> -->
-    <file>CdbTest.php</file>
-    <file>DatabaseSqliteTest.php</file>
-    <file>DatabaseTest.php</file>
-    <file>GlobalTest.php</file>
-       <!--<file>HttpTest.php</file>-->
-    <file>IPTest.php</file>
-    <file>ImageFunctionsTest.php</file>
-    <file>LanguageConverterTest.php</file>
-    <file>LicensesTest.php</file>
-    <file>LocalFileTest.php</file>
-    <file>MediaWikiParserTest.php</file>
-    <file>MessageTest.php</file>
-    <file>RevisionTest.php</file>
-    <file>SanitizerTest.php</file>
-    <file>SearchDbTest.php</file>
-    <file>SearchEngineTest.php</file>
-    <file>SearchUpdateTest.php</file>
-    <file>SiteConfigurationTest.php</file>
-    <file>TimeAdjustTest.php</file>
-    <file>TitlePermissionTest.php</file>
-    <file>TitleTest.php</file>
-    <file>UploadTest.php</file>
-    <file>UploadFromUrlTestSuite.php</file>
-    <file>XmlTest.php</file>
-  </testsuite>
+                stopOnFailure="false">
+  <!-- for the test file list, see TestFileList.php -->
   <groups>
     <exclude>
       <group>Broken</group>